package com.example._13redis_session.service.service;

import com.example._13redis_session.pojo.User;
import com.example._13redis_session.repository.UserRepository;
import com.example._13redis_session.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @auther 0785fanlei.
 * @date 2022/4/8 16:26
 */

@Service
public class UserServiceImpl implements IUserService
{
    @Autowired
    private UserRepository userRepository;

    @Override
    public boolean register(User user)
    {
        return userRepository.save(user)!=null;
    }

    @Override
    public User loginchk(String username, String password)
    {
        User user = userRepository.findByUsernameAndPassword(username,password);
        return user;
    }
}
